package com.project.mapper;

import com.project.bean.ManBean;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 公民的mapper接口
 */
@Mapper//标识该接口为mapper接口
public interface IManMapper {
    /**
     * 添加公民
     * @param man 公民对象
     */
    @Insert("INSERT INTO t_man(m_name,m_sex,m_birthday,m_phone) " +
            "VALUES (#{name},#{sex},#{birthday},#{phone});")
    public void add(ManBean man);

    /**
     * 查询所有公民
     * @return 公民集合
     */
    @Select("select * from t_man")
    @ResultMap("manMap")
    public List<ManBean> findAll();
}
